package cn.hznc.domain.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;

import java.util.Objects;

@Table(name = "t_menu")
@TableName(value = "t_menu")
@Data
public class MenuEntity {

    @Column(name = "id",type = MySqlTypeConstant.INT,length = 11,isKey = true,isAutoIncrement = true)
    private Integer id;
    /**
     * 界面名称
     */
    @Column(name = "menu_name", type = MySqlTypeConstant.VARCHAR, length = 255)
    private String menuName;
    /**
     * 界面的url
     */
    @Column(name = "menu_url", type = MySqlTypeConstant.VARCHAR, length = 255)
    private String menuUrl;
    /**
     * 界面的父id
     */
    @Column(name = "father_id",type = MySqlTypeConstant.INT,length = 11)
    private Integer fatherId;

    /**
     * 权限编码
     */
    @Column(name = "permission_code",type = MySqlTypeConstant.VARCHAR,length = 300)
    private String permissionCode;

    /**
     * 菜单类型
     */
    @Column(name = "permission_type",type = MySqlTypeConstant.TINYINT)
    private Integer permissionType;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof MenuEntity)) return false;
        MenuEntity that = (MenuEntity) o;
        return Objects.equals(id, that.id) && Objects.equals(menuName, that.menuName) && Objects.equals(menuUrl, that.menuUrl) && Objects.equals(fatherId, that.fatherId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, menuName, menuUrl, fatherId);
    }
}
